﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ImageEncryptor.Core.Common.Validators
{
    internal class ValidatorBase
    {
        internal void BreakIfArgIsNull<TArg>(TArg arg, string errorMessage)
            where TArg : class
        {
            if (arg == null)
            {
                throw new ArgumentNullException(errorMessage, (Exception)null);
            }
        }

        internal void BreakIfArgIsNull<TArg>(TArg arg)
            where TArg : class
        {
            if (arg == null)
            {
                throw new ArgumentNullException("Argument can't be null.", (Exception)null);
            }
        }

        internal void BreakIfAnyArgIsNull<TArg>(params TArg[] args)
            where TArg : class
        {
            if (args.Any(arg => arg == null))
            {
                throw new ArgumentNullException();
            }
        }
    }
}
